/**
* v-disable-click 按钮防重
*/

export default {
  inserted: function (el) {
    let disabled = false
    el.addEventListener('click', () => {
      if (!disabled) {
        el.disabled = true
        setTimeout(() => {
          el.disabled = false
        }, 2000)
      } else {
        event.preventDefault()
        event.stopImmediatePropagation()
      }
    })
  },
}
